//
//  NSString+Helpers.h
//  oCoffee
//
//  Created by xlg on 15/6/2.
//  Copyright (c) 2015年 osell. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (Helpers)

- (NSString *) md5;

- (NSString *)base64String;

- (NSString *)fromBase64String;

/**
 * 获取URL字符串中指定参数的值
 */
- (NSString *)valueWithURLParamName:(NSString *)paramName;
/**
 * URL解码
 */
- (NSString*) decode;
/**
 * URLEncode
 */
- (NSString *)URLEncode;

- (NSString *)URLEncodeOnlySymbol:(NSString*)symbol;

+(NSString *) jsonStringWithDictionary:(NSDictionary *)dictionary;

+(NSString *) jsonStringWithArray:(NSArray *)array;

+(NSString *) jsonStringWithString:(NSString *) string;

+(NSString *) jsonStringWithObject:(id) object;

+(NSString *) genUUID;
- (NSString*)trim;
+(BOOL)isNotNULLOrNotNilOrNotEmpty:(NSString *)string;

+ (NSString *)avoidNull:(NSString*)str;
/**
 *  手机号码正则校验
 *
 *  @return BOOL
 */
- (BOOL)isMobileNo;

- (BOOL)isPwd;

/**
 *  身份证号正则校验
 *
 *  @return BOOL
 */
- (BOOL)isIDCard;

/**
 *  邮箱正则校验
 *
 *  @return BOOL
 */
- (BOOL)isEmail;

/**
 *  数字正则校验
 *
 *  @return BOOL
 */
- (BOOL)isNumber;

/**
 *  URL正则校验
 *
 *  @return BOOL
 */
- (BOOL)isURL;

+ (CGSize)labelAutoCalculateRectWith:(NSString*)text FontSize:(CGFloat)fontSize MaxSize:(CGSize)maxSize;

// 时间戳转时间字符串
+ (NSString *)dateStringWithTimeStamp:(NSString *)timeStamp;

/**
 *  判断是否为空
 *
 *  @param string 判断的值
 *
 *  @return BOOL
 */
+ (BOOL) isNullOrEmpty:(NSString *)string;

/**
 *  NSDictionary转为String
 *
 *  @param dic NSDictionary
 *
 *  @return 字符串
 */
+ (NSString*)dictionaryToJson:(NSDictionary *)dic;
@end
